<extend name="Public/base"/>
<block name="body">
    <div class="main-title" style="padding-bottom: 10px;">
        <h2>实时销售数据</h2>
    </div>
    <div class="cf">
        <form action="{:U('SpReport/overallactualtime')}" method='post' id="form-search" style="float: left;">
            <select name="shopId" id="shopId" class="search-input">
                <option value='-1'>全部门店</option>
                <volist name='shoplist' id='vo'>
                    <option value='{$vo.id}'<if condition="$vo.id eq $shopid">selected="selected"</if>>{$vo.name}</option>
                </volist>
            </select>
            开始时间：<input type="text" id="datetimeBegin" name="beginTime" value="{$beginTime}" />
            截止时间：<input type="text" id="datetimeEnd" name="endTime" value="{$endTime}" />
            <input type="submit" class="btn btn-primary" value="统计"/>
        </form>
    </div>
    <br/>
    <h4>销售统计</h4>
    <br/>
    <div style="color: red;font-size: 16px;">
        当前时间段销售总额：{$sellAmountAll_month}&nbsp;&nbsp;
        当前时间段支付总额：{$payAmountAll_month}&nbsp;&nbsp;
        销售总有效单数：{$orderCount_usefull}&nbsp;&nbsp;
        反结账单数：{$orderCount_cancel}&nbsp;&nbsp;
        退单数：{$orderCount_tui}
    </div>
    <div class="data-table table-striped" style="font-size: 13px;">
        <table>
            <thead>
            <tr>
                <th>日期</th>
                <th>直果汁</th>
                <th>直水果</th>
                <th>直小吃</th>
                <th>直套餐</th>
                <th>直处理品</th>
                <th>直耗材</th>
                <th>直服务费</th>
                <th>团果汁</th>
                <th>团水果</th>
                <th>团小吃</th>
                <th>团套餐</th>
                <th>线上果汁</th>
                <th style="color: red;">合计</th>
                <th>现金</th>
                <th>银联</th>
                <th>会员卡</th>
                <th>支付宝</th>
                <th>美团</th>
                <th>百度糯米</th>
                <th>饿了么</th>
                <th>线上</th>
                <th style="color: red;">合计</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td>{$vo[0]} </td>
                        <td>{$vo[1]} </td>
                        <td>{$vo[2]} </td>
                        <td>{$vo[3]} </td>
                        <td>{$vo[4]} </td>
                        <td>{$vo[5]} </td>
                        <td>{$vo[6]} </td>
                        <td>{$vo[7]} </td>
                        <td>{$vo[8]} </td>
                        <td>{$vo[9]} </td>
                        <td>{$vo[10]} </td>
                        <td>{$vo[11]} </td>
                        <td>{$vo[12]} </td>
                        <td>{$vo[13]} </td>
                        <td>{$vo[14]} </td>
                        <td>{$vo[15]} </td>
                        <td>{$vo[16]} </td>
                        <td>{$vo[17]} </td>
                        <td>{$vo[18]} </td>
                        <td>{$vo[19]} </td>
                        <td>{$vo[20]} </td>
                        <td>{$vo[21]} </td>
                        <td>{$vo[22]} </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="23" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <br/>   <br/>
    <h4>充值统计</h4>
    <br/>
    <div style="color: red;font-size: 16px;">
        当前时间段充值总额：{$totalChargeAmount}&nbsp;&nbsp;
        现金充值总额：{$totalChargeAmount_cash}&nbsp;&nbsp;
        银联充值总额：{$totalChargeAmount_unionpay}&nbsp;&nbsp;
        支付宝充值总额：{$totalChargeAmount_alipay}&nbsp;&nbsp;
        公司直充充值总额：{$totalChargeAmount_company}&nbsp;&nbsp;
        广源丁山券充值总额：{$totalChargeAmount_guangyuan}&nbsp;&nbsp;
        充值笔数： {$chargeCount}&nbsp;&nbsp;
        新办卡数量： {$membercardCount}
    </div>
    <div class="data-table table-striped" style="font-size: 13px;">
        <table>
            <thead>
            <tr>
                <th>日期</th>
                <th>面值金额</th>
                <th>赠送金额</th>
                <th>合计</th>
                <th>现金</th>
                <th>刷卡</th>
                <th>支付宝</th>
                <th>公司直充</th>
                <th>广源丁山券</th>
                <th>小计</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="_listCharge">
                <volist name="_listCharge" id="vo">
                    <tr>
                        <td>{$vo[0]} </td>
                        <td>{$vo[1]} </td>
                        <td>{$vo[2]} </td>
                        <td>{$vo[3]} </td>
                        <td>{$vo[4]} </td>
                        <td>{$vo[5]} </td>
                        <td>{$vo[6]} </td>
                        <td>{$vo[7]} </td>
                        <td>{$vo[8]} </td>
                        <td>{$vo[9]} </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        //搜索查询
        $('#submit').click(function () {
            document.getElementById("form-search").submit()
        });
        //导航高亮
        highlight_subnav('{:U('SpReport/overallactualtime')}');

        $(function () {
            $('#datetimeBegin').datetimepicker({
                timepicker:false,
                format:'Y-m-d H:i',
                language: 'zh-CN',
                autoclose: true
            });
            $('#datetimeEnd').datetimepicker({
                timepicker:false,
                format:'Y-m-d H:i',
                language: 'zh-CN',
                autoclose: true
            });

            var currentTime=new Date();
            var dateTimeBegin=currentTime.getFullYear()+"-"+parseFloat(currentTime.getMonth()+1)+"-"+currentTime.getDate()+" 00:00";
            var dateTimeEnd=currentTime.getFullYear()+"-"+parseFloat(currentTime.getMonth()+1)+"-"+currentTime.getDate()+" 23:59";
            if( $('#datetimeBegin').val()==""){
                $('#datetimeBegin').val(dateTimeBegin);
            }
            if( $('#datetimeEnd').val()==""){
                $('#datetimeEnd').val(dateTimeEnd);
            }
        })

        function getValue(){
            if($("#shopId option:selected").val().length>0&&$("#datetimeBegin").val().length>0&&$("#datetimeEnd").val().length>0){
                $("#shoplist").val($("#shopId").val()) ;
                $("#beginTime").val($("#datetimeBegin").val()) ;
                $("#endTime").val($("#datetimeEnd").val()) ;
                document.getElementById("form-export").submit();
            } else {
                return false;
            }
        }
    </script>
</block>